{% extends 'layout.html' %}
{% load static %}
{% block css %}
    <style>
        .highlight-text {
            font-weight: 1000;
            font-size: 16px;
            color: #c9302c;
        }

        p {
            font-size: 14px;
            text-indent: 2em;
        }

        .website-text {
            font-size: 12px;
            font-weight: bold;
        }
    </style>

{% endblock %}
{% block content %}
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading"><i class="fa fa-line-chart"></i> 外部服务网攻击趋势统计图</div>
                <div class="panel-body">
                    <div id="chart" style="width:100%;min-height:300px"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-4">
            <div class="panel panel-default">
                <div class="panel-heading"><i class="fa fa-navicon" aria-hidden="true"></i> 攻击看板</div>
                <div class="panel-body">
                    {% if statistics_all_dict.is_day %}
                        <p><span
                                class="highlight-text">{{ statistics_all_dict.start_datetime }} 至{{ statistics_all_dict.end_datetime }}</span>,

                            外部服务网拦截攻击<span class="highlight-text">{{ statistics_all_dict.total_count }}</span>次，
                            环比昨日{{ statistics_all_dict.relative_yesterday|safe }}
                            其中K01拦截<span class="highlight-text">{{ statistics_all_dict.k01_atk_count }}</span>次，
                            瑞数动态防御系统拦截异常请求<span
                                    class="highlight-text">{{ statistics_all_dict.abnormal_request_count }}</span>次，
                            深信服核心防火墙拦截攻击<span
                                    class="highlight-text">{{ statistics_all_dict.sangfor_fw_attack_count }}</span>次，
                            奇安信威胁检测与分析平台（天眼）告警<span
                                    class="highlight-text">{{ statistics_all_dict.skyeye_attack_count }}</span>次，
                            攻击IP数量<span class="highlight-text">{{ statistics_all_dict.atkip_count }}</span>个,
                            集中分析平台自动封禁IP<span class="highlight-text">{{ statistics_all_dict.blockip_automatic }}</span>个，
                            人工研判封禁IP<span class="highlight-text">{{ statistics_all_dict.blockip_manual }}</span>个，
                            k01拦截IP<span class="highlight-text">{{ statistics_all_dict.k01_attackip_count }}</span>个,
                            共计拦截高危IP<span class="highlight-text">{{ statistics_all_dict.total_blockip_count }}</span>个,
                            环比昨日{{ statistics_all_dict.relative_yesterday_blockip|safe }}
                            外联数量<span class="highlight-text">{{ statistics_all_dict.outgoing_count }}</span>个。
                            主要威胁来源(高危IP数)：{{ statistics_all_dict.botgate_location_account|safe }}。
                        </p>
                        <p>
                            <span style="font-weight: bold;">主要攻击站点(Top5)：</span><br>
                            {{ statistics_all_dict.botgate_website_request|safe }}
                        </p>
                        <p>
                            <span style="font-weight: bold;">主要攻击类型(Top5)：</span><br>
                            {{ statistics_all_dict.injectattacktype|safe }}。
                        </p>
                        <p>
                            <span style="font-weight: bold;">其中Nday攻击类型(Top5)：</span><br>{{ statistics_all_dict.ndayattack|safe }}。
                        </p>
                        <p>
                            <span style="font-weight: bold;">高危IP列表：</span><br>
                            {{ statistics_all_dict.blockip_list|safe }}
                        </p>
                    {% else %}
                        <p><span
                                class="highlight-text">{{ statistics_all_dict.start_datetime }} 至{{ statistics_all_dict.end_datetime }}</span>,
                            外部服务网拦截攻击<span class="highlight-text">{{ statistics_all_dict.total_count }}</span>次，
                            其中K01拦截<span class="highlight-text">{{ statistics_all_dict.k01_atk_count }}</span>次，
                            瑞数动态防御系统拦截异常请求<span
                                    class="highlight-text">{{ statistics_all_dict.abnormal_request_count }}</span>次，
                            深信服核心防火墙拦截攻击<span
                                    class="highlight-text">{{ statistics_all_dict.sangfor_fw_attack_count }}</span>次，
                            奇安信威胁检测与分析平台（天眼）告警<span
                                    class="highlight-text">{{ statistics_all_dict.skyeye_attack_count }}</span>次，
                            攻击IP数量<span class="highlight-text">{{ statistics_all_dict.atkip_count }}</span>个，
                            集中分析平台自动封禁IP<span class="highlight-text">{{ statistics_all_dict.blockip_automatic }}</span>个，
                            人工研判封禁IP<span class="highlight-text">{{ statistics_all_dict.blockip_manual }}</span>个，
                            k01拦截IP<span class="highlight-text">{{ statistics_all_dict.k01_attackip_count }}</span>个，
                            外联数量<span class="highlight-text">{{ statistics_all_dict.outgoing_count }}</span>个。
                            主要威胁来源：{{ statistics_all_dict.botgate_location_account|safe }}。
                        </p>
                        <p>
                            <span style="font-weight: bold;">主要攻击站点(Top5)：</span><br>
                            {{ statistics_all_dict.botgate_website_request|safe }}
                        </p>
                        <p>
                            <span style="font-weight: bold;">主要攻击类型(Top5)：</span><br>
                            {{ statistics_all_dict.injectattacktype|safe }}。
                        </p>
                        <p>
                            <span style="font-weight: bold;">其中Nday攻击类型(Top5)：</span><br>
                            {{ statistics_all_dict.ndayattack|safe }}。
                        </p>
                        <p>
                            <span style="font-weight: bold;">高危IP列表：</span><br>
                            {{ statistics_all_dict.blockip_list|safe }}
                        </p>
                    {% endif %}
                </div>
            </div>

        </div>
        <div class="col-md-8">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>日期</th>
                    <th>k01拦截数</th>
                    <th>瑞数异常请求数</th>
                    <th>深信服防火墙攻击数</th>
                    <th>天眼分析平台报警数</th>
                    <th>攻击IP数量</th>
                    <th>合计</th>
                </tr>
                </thead>
                <tbody>
                {% for row in queryset %}
                    <tr>
                        <td>{{ row.ctime }}</td>
                        <td>{{ row.atk_count }}</td>
                        <td>{{ row.abnormal_request_count }}</td>
                        <td>{{ row.attack_count }}</td>
                        <td>{{ row.total }}</td>
                        <td>{{ row.atkip_count }}</td>
                        <td>{{ row.total_count }}</td>

                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock %}

{% block js %}
    <script src="{% static 'plugins/highcharts/highcharts.js' %}"></script>
    <script src="{% static 'js/line_chart.js' %}"></script>
    <script>
        var CHART_TITLE = "外部服务网攻击数量统计";
        var API_URL = "{% url 'home_chart' %}";
        $(function () {
            initChart();
        });
    </script>

{% endblock %}